package edu.sdjzu;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProviderController {

    @GetMapping("/data")
    @SentinelResource(value = "data", blockHandler = "handleBlock")
    public String getData() {
        return "provider提供的数据";
    }

    public String handleBlock( BlockException ex) {
        return "请求被Sentinel拦截";
    }
}